#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
typedef long long ll;
using namespace std;



//最大通过数
/*
int n, m, k;
const int N = 1e5 + 10;
int a[N], b[N];
int _count;

int solve() {
	int ans = 0;			//返回的关卡值
	for (int i = 0; i <= n; ++i) {
		int temp = k - a[i];
		if (temp <= 0)
			return ans;
		int com = 0;        //临时比较值
		for (int j = 0; j <= m; ++j) {			
			if (temp - b[j] < 0){
				ans = max(i + j - 1, ans);
				break;
			}
		}				
	}
	return ans;
}


int main()
{
	cin >> n >> m >> k;

	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
		a[i] = a[i - 1] + a[i];
	}
	for (int i = 1; i <= m; ++i) {
		cin >> b[i];
		b[i] = b[i - 1] + b[i];
	}
	int ret = solve();
	cout << ret ;
	return 0;
}
*/

// upper_bound
/*
#include <vector>

int main() {
	std::vector<int> v = { 1, 3, 5, 7, 9 };
	int target = 7;
	int a[6]= { 1, 3, 5, 7, 9 };
	// 查找第一个大于 target 的元素
	auto it = upper_bound(v.begin(), v.end(), target);
	upper_bound(a, a + 10, target);
	int ret = upper_bound(a, a + 5, target) - a;
	int res = lower_bound(a, a + 5, target) - a;
	if (it != v.end()) {
		std::cout << "第一个大于 " << target << " 的元素是: " << *it << std::endl;
	}
	else {
		std::cout << "没有找到大于 " << target << " 的元素" << std::endl;
	}
	cout << "ret:" << ret << endl;
	cout << "res:" << res << endl;

	return 0;
}
*/


//拼数字
/*
int n;
const int N = 100;
int a[N];
bool cmp(int a, int b) {
	string str1 = to_string(a);
	string str2 = to_string(b);
	int _size = min(str1.size(), str2.size());
	int i;
	for (i = 0; i < _size; ++i) {
		if (str1[i] == str2[i])
			continue;
		if (str1[i] > str2[i])
			return true;
		else
			return false;
	}
	// 如果前面的位都相同，则比较长度
	if (str1.size() > str2.size()) {
		// 如果 str1 比 str2 长，则比较 str1 的第 _size 位
		if (str1[_size] == '0')
			return false;
		else
			return true;
	}
	else {
		// 如果 str2 比 str1 长，则比较 str2 的第 _size 位
		if (str2[_size] == '0')
			return true;
		else
			return false;
	}
}
int main() {
	cin >> n;
	for (int i = 1; i <= n; ++i) 
		cin >> a[i];

	sort(a + 1, a + n + 1, cmp);

	for (int i = 1; i <= n; ++i) 
		cout << a[i];
	return 0;
}
*/

//sort
/*
const int n = 100;
int a[n];

int main() {
	memset(a, 10, sizeof(a));
	for (int i = 0; i <= 5; ++i) 		
		cin >> a[i];

	cout << "排序前:";
	for (int i = 0; i <= 5; ++i) {
		if(a[i] != 0)
			cout << a[i] << " ";
	}
	cout << endl;
	//sort(a, a + 10); //默认升序
	sort(a+2, a + 5);  //左闭右开 ，相当于排序a+2到a+4
	cout << "排序后:";
	for (int i = 0; i <= 5; ++i) {
		if (a[i] != 0)
			cout << a[i] << " ";
	}
	
	return 0;
}
*/

//cmp概念
/*
	我们的排序函数都支持一个名为 cmp 的比较器函数，其接收了两个参数 a 与 b。
在比较器函数内对 a 与 b 进行操作。当cmp 函数返回值为 true ，表示 a 应该排在 b 的前面（a <b)，
反之，a 应该排在 b 的后面（a > b )
*/

/*
//区间排序
int n;
const int N = 110;
int a[N];
int q;
void solve(int i, int j) {
	sort(a + i, a + j + 1);
}
int main() {
	int l, r;
	cin >> n;
	for (int i = 1; i <= n; ++i) cin >> a[i];
	cin >> q;
	while (q--) {
		cin >> l >> r;
		solve(l, r);
	}
	for (int i = 1; i <= n; ++i) 
		cout<< a[i]<<" ";
	return 0;
}
*/

//奇偶排序
/*
bool cmp(int a, int b) {
	if (a % 2 == b % 2)
		return a < b;
	if (a % 2 == 0)
		return false;
	return true;
}
int main() {
	cin >> n;
	for (int i = 1; i <= n; ++i) 
		cin >> a[i];
	sort(a+1, a + n + 1, cmp);
	for (int i = 1; i <= n; ++i)
		cout << a[i]<<" ";
}
*/

// 三国游戏(多理解题意)

int n;
const int N = 1e5 + 10;
int a[N], b[N], c[N];
int temp[N];

int solve(int a[],int b[],int c[]) {
	ll ret = 0;

	for (int i = 1; i <= n; ++i) {
		temp[i] = a[i] - b[i] - c[i];
	}
	sort(temp + 1, temp + n + 1, greater<int>());  //greater<int>()是降序排列
	if (temp[1] <= 0)
		return -1;

	int i;
	for (i = 1; i <= n; ++i) {
		ret += temp[i];
		if (ret <= 0)
			break;
	}

	return i-1;
}


int main()
{
	cin >> n;
	for (int i = 1; i <= n; ++i) cin >> a[i];
	for (int i = 1; i <= n; ++i) cin >> b[i];
	for (int i = 1; i <= n; ++i) cin >> c[i];

	int res1 = solve(a, b, c);
	int res2 = solve(b, a, c);
	int res3 = solve(c, a, b);
	int res_temp = max(res1, res2);
	int res = max(res_temp, res3);
	cout << res;
	return 0;
}




